﻿@model IEnumerable<Property4U.Models.Review>

@{
    ViewBag.Title = "Reviews";
}

<link href="~/Content/bootstrap-rating.css" rel="stylesheet">

<div class="row">
    <!-- Page Header -->
    <div class="col-lg-12">
        <h1 class="page-header">@ViewBag.Title</h1>
    </div>
    <!--End Page Header -->
</div>

<p>
    @Html.ActionLink("Create New", "Create")
</p>
<table class="table">
    <tr>
        <th>
            @Html.DisplayNameFor(model => model.PropertyID)
        </th>
        <th>
            @Html.DisplayNameFor(model => model.Name)
        </th>
        <th>
            @Html.DisplayNameFor(model => model.EmailAddress)
        </th>
        <th>
            @Html.DisplayNameFor(model => model.Rating)
        </th>
        <th>
            @Html.DisplayNameFor(model => model.Description)
        </th>
        <th>
            @Html.DisplayNameFor(model => model.ReviewOn)
        </th>
        <th>
            @Html.DisplayNameFor(model => model.IPAddress)
        </th>
        <th></th>
    </tr>

@foreach (var item in Model) {
    <tr>
        <td>
            @Html.DisplayFor(modelItem => item.PropertyID)
        </td>
        <td>
            @Html.DisplayFor(modelItem => item.Name)
        </td>
        <td>
            @Html.DisplayFor(modelItem => item.EmailAddress)
        </td>
        <td>
            <input type="hidden" class="rating" value="@item.Rating" data-start="1" data-stop="6" readonly="readonly" />
        </td>
        <td>
            @Html.DisplayFor(modelItem => item.Description)
        </td>
        <td>
            @Html.DisplayFor(modelItem => item.ReviewOn)
        </td>
        <td>
            @Html.DisplayFor(modelItem => item.IPAddress)
        </td>
        <td>
            @*@Html.ActionLink("Edit", "Edit", new { id=item.ID }) |*@
            @Html.ActionLink("Details", "Details", new { id=item.ID }) |
            @Html.ActionLink("Delete", "Delete", new { id=item.ID })
        </td>
    </tr>
}

</table>

@section scripts{
    <script type="text/javascript" src="~/Scripts/bootstrap-rating.js"></script>
    @*<script type="text/javascript">
            var a = $('#rating').on('change', function () {
                alert('Selected Rating: ' + $(this).val());
            });
        </script>*@

}